<template>
	<view>
		<view class="" v-if="total">
			<view class=" box-color box-padding">
				<view class="u-flex u-row-between" >
					<text class="u-font-32">关单卫检</text>
					<text class="u-font-26 grey-color" @click="toPage" v-if="total>5" >查看全部</text>
				</view>
			</view>
			<u-cell-group :border="false" class="u-m-b-20">
				<u-cell-item  hover-class="cell-hover-class" @tap="$mRouter.push({route:'/pages/index/billDetails?id='+item.dockReceiptId+'&itemName='+itemName+'&productDate='+$fui.dateFormatter(item.dateOfManufacture,'yyy-mm-dd')})"  v-for="(item, index) in comment" :key="item.id" :border-bottom="index!== (comment.length-1)">
					<view slot="icon" class="u-m-r-10" 	>
						<u-icon name="order" top="0"></u-icon>
					</view>
					<view slot="title">
						<text style="color: #999;margin-right: 20rpx;">生产日期</text>
						<text>{{$fui.dateFormatter(item.dateOfManufacture,'yyy-mm-dd')}}</text>
					</view>
				</u-cell-item>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				comment:[],
				total:0
			}
		},
		props: {
			itemId: {
				type: String,
				default: '',
			},
			itemName:{
				type: String,
				default: '',
			}
		},
		created() {
			this.getBillListFn();
		},
		methods: {
			async getBillListFn(){
				let params = {
					idOrName:this.itemId,
					PageIndex:1,
					PageSize: 5,
				}
				const res = await this.$newHttp.get('api/Product/GetPagedDockReceiptByItem', { params: params });
				if(res.code === 200){
					this.comment = res.data.list;
					this.total = res.data.totalCount;
				}else{
					this.comment = [];
				}
			},
			toPage(){
				this.$mRouter.push({
					route:'/pages/index/xiangqing/billListPage?id='+this.itemId+'&itemName='+this.itemName,
				})
			},
		}
	}
</script>

<style>
</style>